package com.ftg.learn.execl.task;

import com.alibaba.excel.util.StringUtils;
import com.ftg.learn.execl.util.RedisKeySerializableUtil;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Set;

/**
 * 读redis 写rabbitmq
 *
 * @author 布衣
 */
@Component
public class SendMessToRabbitMqTask {

    @Resource
    private RedisTemplate<String,String> redisTemplate;
    public void sendMessToRabbitMq() {

        //读redis
        HashOperations<String, String, String> hashOperations = redisTemplate.opsForHash();
        Set<String> fields =  hashOperations.keys("record");
        for (String field : fields) {
            String[] vals = field.split("_");
            String json = hashOperations.get(vals[0],vals[1]);
            if (StringUtils.isEmpty(json) ){
                //发送信息到rabbitmq
            }
        }

    }

}
